package cn.growthgate.fgo.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import cn.growthgate.fgo.factory.EnumConverterFactory;
import cn.growthgate.fgo.interceptor.PrintRequestInterceptor;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
	
	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(new PrintRequestInterceptor())
				.excludePathPatterns("/css/**", "/js/**", "/img/**", "/widgets/**");
	}

	@Override
	public void addFormatters(FormatterRegistry registry) {
		registry.addConverterFactory(new EnumConverterFactory());
	}

}
